package app

import (
	"gitee.com/mkwchecking/sr-core/config"
	"gitee.com/mkwchecking/sr-core/config/source"
)

func SetupConfig(opts ...source.Option) (*config.Config, error) {
	src, err := source.New(opts...)
	if err != nil {
		return nil, err
	}

	if err := src.Scan(config.Get()); err != nil {
		return nil, err
	}

	return config.Get(), nil
}
